package com.tykboot.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.tykboot.core.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.GenericGenerator;

import java.util.Date;
import javax.persistence.*;

/**
 * 
 *
 * @author LiuYu
 */
@ApiModel("account_request")
@Entity
@Table(name = "tb_account_request")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
public class TbAccountRequest extends BaseEntity {

	/**
	 * 
	 */
	@Id
	@GeneratedValue(generator = "jpa-uuid")
	@Column(name = "accountRequestId")
	private String accountRequestId;

	/**
	 * 
	 */
	@JsonIgnore
	@ApiModelProperty(hidden = true)
	@Column(name = "financialId")
	private String financialId;

	/**
	 * 
	 */
	@JsonIgnore
	@ApiModelProperty(hidden = true)
	@Column(name = "permissions")
	private String permissionsDb;


	/**
	 * 
	 */
	@Column(name = "creationDateTime")
	private Date creationDateTime;

	/**
	 * 
	 */
	@Column(name = "expirationDateTime")
	private Date expirationDateTime;

	/**
	 * 
	 */
	@Column(name = "transactionFromDateTime")
	private Date transactionFromDateTime;

	/**
	 * 
	 */
	@Column(name = "transactionToDateTime")
	private Date transactionToDateTime;

	@Transient
	private String[] permissions;

	public String getAccountRequestId() {
		return accountRequestId;
	}

	public void setAccountRequestId(String accountRequestId) {
		this.accountRequestId = accountRequestId;
	}

	public String getFinancialId() {
		return financialId;
	}

	public void setFinancialId(String financialId) {
		this.financialId = financialId;
	}

	public String getPermissionsDb() {
		return permissionsDb;
	}

	public void setPermissionsDb(String permissionsDb) {
		this.permissionsDb = permissionsDb;
	}

	public Date getCreationDateTime() {
		return creationDateTime;
	}

	public void setCreationDateTime(Date creationDateTime) {
		this.creationDateTime = creationDateTime;
	}

	public Date getExpirationDateTime() {
		return expirationDateTime;
	}

	public void setExpirationDateTime(Date expirationDateTime) {
		this.expirationDateTime = expirationDateTime;
	}

	public Date getTransactionFromDateTime() {
		return transactionFromDateTime;
	}

	public void setTransactionFromDateTime(Date transactionFromDateTime) {
		this.transactionFromDateTime = transactionFromDateTime;
	}

	public Date getTransactionToDateTime() {
		return transactionToDateTime;
	}

	public void setTransactionToDateTime(Date transactionToDateTime) {
		this.transactionToDateTime = transactionToDateTime;
	}

	public String[] getPermissions() {
		return this.permissionsDb.split(",");
	}

	public void setPermissions(String[] permissions) {
		this.permissions = permissions;
	}
}

